var timeThisWeek = function (type,dates) {
    
    var now = new Date();

    var nowTime = now.getTime();
    var day = now.getDay();
    var longTime = 24 * 60 * 60 *1000;
    var n = longTime * 7 * (dates || 0);
    if(type == 's'){
        var dd =nowTime - (day - 1) * longTime + n;
    }
    if(type =='e'){
        // eslint-disable-next-line no-redeclare
        var dd =nowTime + (7 - day) * longTime + n ;
    }
    dd = new Date(dd);
    var  y = dd.getFullYear();
    var m = dd.getMonth() + 1;
    var d = dd.getDate() ;
    m=m<10?"0"+m:m
    d=d<10?"0"+d:d
    // eslint-disable-next-line no-redeclare
    var day= y + "-" + m + "-" + d;
    return day
 }

export default timeThisWeek